package main

import (
	"flag"
	"log"
	"net/http"
	"strconv"
)

var (
	port    = flag.Int("p", 4567, "http listen port")
	timeout = flag.Int("t", 30, "task timeout, unit second, 0 is not limit")
)

func main() {
	flag.Parse()

	for _, t := range _Tasks {
		_Cron.add(t)
	}
	go _Cron.run()

	http.HandleFunc("/", taskHandle)
	http.HandleFunc("/list", listHandle)
	log.Printf("gocron listen on: %d\n", *port)
	log.Fatal(http.ListenAndServe(":"+strconv.Itoa(*port), nil))
}
